package com.tqw.auth.service.impl;

import com.tqw.auth.dao.LoginClientMapper;
import com.tqw.auth.pojo.Client;
import com.tqw.auth.pojo.ClientLogin;
import com.tqw.auth.service.LoginClientService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import java.util.Map;

/**
 * @author Van
 */
@Slf4j
@Service
public class LoginClientServiceImpl implements LoginClientService {

    @Autowired
    private PasswordEncoder passwordEncoder;

    @Autowired
    private LoginClientMapper loginClientMapper;
    @Override
    public Client loginClient(ClientLogin clientLogin) {
        if (passwordEncoder.matches(clientLogin.getPassword(),loginClientMapper.selectClient(clientLogin))){
            return loginClientMapper.loginClient(clientLogin);
        }
        return null;
    }

    @Override
    public Map<String, Object> checktoken(String token) {
        return null;
    }
}

